package com.leoncom.sms_silencer;

import com.leoncom.sms_silencer.util.MuterHelper;
import com.leoncom.sms_silencer.util.NotifyManagerHelper;
import com.leoncom.sms_silencer.util.SmsLogger;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Bundle;
import android.util.Log;

public class MuterReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context ctxt, Intent intent) {
		// TODO Auto-generated method stub
		Bundle bundle = intent.getExtras();
		String info = "";
		int code = -1;
		if (bundle != null) {
			info = bundle.getString("tag");
			code = bundle.getInt("code");
			if (info.equalsIgnoreCase("mute")) {
				MuterHelper.setToMute(ctxt);
			} else if (info.equalsIgnoreCase("unmute")) {
				MuterHelper.setToUnMute(ctxt);
			}
			SmsLogger.append("MuterReceiver[" + String.valueOf(code) +  "] "  + info);
		} else {
			SmsLogger.append("Invalid startIntent");
		}
		Log.i("SmsSilencer", "MuterReceiver[" + String.valueOf(code) +  "] "  + info);
	}

}
